package com.bharatonjava.hospital.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LoggingExceptionResolver extends AbstractHandlerExceptionResolver {
    private static final Logger logger = LoggerFactory.getLogger(LoggingExceptionResolver.class);

    @Override
    protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
        logger.warn("uncaught exception in controllers/handlers", ex);
        return null;
    }
}